import 'package:flutter/material.dart';
import '/pages/e_error_parser.dart';
import '/pages/e_parser_acion.dart';

import 'e_and_parser.dart';
import 'e_build_parser.dart';
import 'e_extension_parser.dart';
import 'e_lookahead.dart';
import 'e_optimization.dart';
import 'e_reuse_parser.dart';
import 'e_sensitive.dart';

//, 组合解析器, 重用解析器, 扩展解析器, 错误处理,解析动作, 预测性解析, 上下文敏感解析, 解析优化
class FunctionList extends StatelessWidget {
  final functionList = ["构建解析器", "组合解析器", "重用解析器", "扩展解析器", "错误处理", "预测性解析", "上下文敏感解析"]; //
  final pages = <Widget>[
    EBuildParser(),
    EAndParser(),
    EReuseParser(),
    EExtensionParser(),
    EErrorParser(),
    // EParserAction(),
    ElookaheadParser(),
    ESensitiveParser(),
    // EOptimizationParser(),
  ];

  FunctionList({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('petitparser功能演示'),
      ),
      body: ListView.builder(
        itemCount: functionList.length,
        itemBuilder: (context, index) {
          return GestureDetector(
            onTap: () {
              Navigator.push(context, MaterialPageRoute(builder: (_) {
                return pages[index];
              }));
            },
            child: ListTile(
              title: Text(functionList[index]),
            ),
          );
        },
      ),
    );
  }
}
